9baea429175e6e08a56ab56103c55aac44a6f150,portal-impl/src/com/liferay/portlet/usersadmin/lar/OrganizationStagedModelDataHandler.java,OrganizationStagedModelDataHandler,importPhones,#PortletDataContext#Organization#,332
Before Change
protected List<Phone> importPhones(
PortletDataContext portletDataContext, Organization organization) {
String path = getDependentModelPath(organization, Phone.class);
List<Phone> phones =
(List<Phone>)portletDataContext.getZipEntryAsObject(path);
for (Phone phone : phones) {
phone.setPhoneId(0);
}
return phones;
}
protected List<Website> importWebsites(
After Change
protected void importPhones(
PortletDataContext portletDataContext,
Organization importedOrganization, Organization organization)
throws PortalException, SystemException {
List<Element> phoneElements =
portletDataContext.getReferenceDataElements(
organization, Phone.class);
List<Phone> phones = new ArrayList<Phone>(phoneElements.size());
for (Element phoneElement : phoneElements) {
String path = phoneElement.attributeValue("path");
Phone phone = (Phone)portletDataContext.getZipEntryAsObject(path);
phone.setClassPK(importedOrganization.getOrganizationId());
StagedModelDataHandlerUtil.importStagedModel(
portletDataContext, phone);
Map<Long, Long> newPrimaryKeysMap =
(Map<Long, Long>)portletDataContext.getNewPrimaryKeysMap(
Phone.class);
long phoneId = newPrimaryKeysMap.get(phone.getPrimaryKey());
phone.setPrimaryKey(phoneId);
phones.add(phone);
}
UsersAdminUtil.updatePhones(
Organization.class.getName(),
importedOrganization.getOrganizationId(), phones);
}
protected void importWebsites(